package com.mypackage.diary.modle;

// Generated Oct 28, 2014 3:47:35 PM by Hibernate Tools 4.0.0

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Category generated by hbm2java
 */
@Entity
@Table(name = "Category")
public class Category implements java.io.Serializable {

	private int categoryId;
	private UserProfile userProfile;
	private Serializable name;
	private int parentId;
	private Date created;
	private Date modified;
	private Set<Diary> diaries = new HashSet<Diary>(0);

	public Category() {
	}

	public Category(int categoryId, UserProfile userProfile, Serializable name,
			int parentId, Date created) {
		this.categoryId = categoryId;
		this.userProfile = userProfile;
		this.name = name;
		this.parentId = parentId;
		this.created = created;
	}

	public Category(int categoryId, UserProfile userProfile, Serializable name,
			int parentId, Date created, Date modified, Set<Diary> diaries) {
		this.categoryId = categoryId;
		this.userProfile = userProfile;
		this.name = name;
		this.parentId = parentId;
		this.created = created;
		this.modified = modified;
		this.diaries = diaries;
	}

	@Id
	@Column(name = "CategoryId", unique = true, nullable = false)
	public int getCategoryId() {
		return this.categoryId;
	}

	public void setCategoryId(int categoryId) {
		this.categoryId = categoryId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "AuthorId", nullable = false)
	public UserProfile getUserProfile() {
		return this.userProfile;
	}

	public void setUserProfile(UserProfile userProfile) {
		this.userProfile = userProfile;
	}

	@Column(name = "Name", nullable = false)
	public Serializable getName() {
		return this.name;
	}

	public void setName(Serializable name) {
		this.name = name;
	}

	@Column(name = "ParentId", nullable = false)
	public int getParentId() {
		return this.parentId;
	}

	public void setParentId(int parentId) {
		this.parentId = parentId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Created", nullable = false, length = 23)
	public Date getCreated() {
		return this.created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Modified", length = 23)
	public Date getModified() {
		return this.modified;
	}

	public void setModified(Date modified) {
		this.modified = modified;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "categories")
	public Set<Diary> getDiaries() {
		return this.diaries;
	}

	public void setDiaries(Set<Diary> diaries) {
		this.diaries = diaries;
	}

}
